import { observable, action, toJS } from 'mobx';
import { Tools, Toast, Bubble } from 'weaver-mobile';

const getLabel = Tools.getLabel

export default class TaskCommonStore {

  @action
  showLoading = () => {
    Toast.loading('Loading...', 0)
  }

  @action
  closeLoading = () => {
    Toast.hide()
  }

  @action
  saveSuccess = (duration, onClose) => {
    Bubble.success(getLabel(22619,'保存成功'), duration || 1, {}, 1, onClose, true)
  }

  @action
  deleteSuccess = (duration, onClose) => {
    Bubble.success(getLabel(83472,'删除成功!'), duration || 1, {}, 1, onClose, true)
  }

  @action
  warn = (content) => {
    Bubble.warning(content, 1)
  }

  @action
  remind = (content) => {
    Bubble.remind(content, 1)
  }

  @action
  updateSuccess = () => {
    Bubble.success(getLabel(31439,'更新成功!'), 1)
  }
  
  @action
  attentionSuccess = () => {
    Bubble.success(getLabel(503769,'关注成功!'), 1)
  }

  @action
  cancelAttentionSuccess = () => {
    Bubble.success(getLabel(503772,'取消关注成功!'), 1)
  }
}